remove more clones#8
Merged
appletreeisyellow merged 2 commits intoappletreeisyellow:chunchun/stop-copy-in-SingleDistinctToGroupByfrom May 17, 2024
Conversation
ff5cf45 to
f1e7274
Compare
erratic-pattern
commented
May 17, 2024
| }) if is_single_distinct_agg(&aggr_expr)? | ||
| && !contains_grouping_set(&group_expr) => | ||
| { | ||
| let group_size = group_expr.len(); |
Author
There was a problem hiding this comment.
need to copy the len before moving the expr into the iterator
c02a63a
into
appletreeisyellow:chunchun/stop-copy-in-SingleDistinctToGroupBy
erratic-pattern
commented
May 17, 2024
| .map(|(i, group_expr)| { | ||
| if let Expr::Column(_) = group_expr { | ||
| // For Column expressions we can use existing expression as is. | ||
| (group_expr.clone(), (group_expr, None)) |
Author
There was a problem hiding this comment.
one clone is necessary here
erratic-pattern
commented
May 17, 2024
| ); | ||
| let arg = args.swap_remove(0); | ||
|
|
||
| let expr_id = distinct_aggr_exprs.hasher().hash_one(&arg); |
Author
There was a problem hiding this comment.
use HashSet<u64> with manual hashing instead of HashSet<&Expr> to avoid borrow checker issues.
erratic-pattern
commented
May 17, 2024
| .. | ||
| }) => { | ||
| // is_single_distinct_agg ensure args.len=1 | ||
| if *distinct |
Author
There was a problem hiding this comment.
old code had redundant conditionals so I refactored it into a single if ... else ...
appletreeisyellow
added a commit
that referenced
this pull request
May 23, 2024
…he#10527) * chore: merge main and resolve conflict * chore: use less copy * chore: remove clone * remove more clones (#8) * refactor: use HashSet<&Expr> instead of HashSet<String> * refactor: remove more cloning * chore: reduce string allocation Co-authored-by: Adam Curtis <adam.curtis.dev@gmail.com> * chore: return internal error instead of panacing * chore: use arg display_name as hash key instead of a hashed value --------- Co-authored-by: Adam Curtis <adam.curtis.dev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note this PR is to merging to main, but the branch https://github.com/appletreeisyellow/arrow-datafusion/tree/chunchun/stop-copy-in-SingleDistinctToGroupBy which belongs to PR apache#10527